<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <title>Mock</title>
    <link href="assets/bootstrap/css/bootstrap.css" rel="stylesheet">
    <script type="text/javascript" src="http://a.tbcdn.cn/s/kissy/1.3.0/seed.js"></script>
    <!-- <script src="../node_modules/kissy/build/seed-min.js"></script> -->
    <script src="../dist/mock.js"></script>
</head>
<body>
    <div class="container">
        <h1>Mock 测试 - KISSY</h1>
        <h2>1. 设置模拟数据</h2>
        <pre id="data">
Mock.mock('foo.json', {
  'list|3-5':[{
    'id|+1': 1,
    'name': '@First @Last'
  }]
});
Mock.mock('bar.json', {
  'list|3-5':[{
    'id|+1': 100,
    'email': '@EMAIL'
  }]
});</pre>
        <h2>2. 发送请求</h2>
        <pre id="send">
KISSY.use(['components/mock/index', 'core'], function(S, Mock, Core){
    var $ = S.all;
    KISSY.io({
        url:'foo.json', 
        success: function(data){
            $('#foo').append(S.JSON.stringify(data, null, 4))
        } 
    })
    KISSY.io({
        url:'bar.json',
        success: function(data){
            $('#bar').append(S.JSON.stringify(data, null, 4))
        }
    })
});</pre>
        <h2>3. 响应数据</h2>
        <pre id="foo"></pre>
        <pre id="bar"></pre>
    </div>
    <script type="text/javascript">
        KISSY.use('core', function(S, Core) {
            var $ = S.all;
            eval( $('#data').text() )
            eval( $('#send').text() )
        })
    </script>
</body>
</html>
